// package com.tsx.wiki.interceptor;
//
// import lombok.extern.slf4j.Slf4j;
// import org.springframework.stereotype.Component;
// import org.springframework.web.servlet.HandlerInterceptor;
// import org.springframework.web.servlet.ModelAndView;
//
// import javax.servlet.http.HttpServletRequest;
// import javax.servlet.http.HttpServletResponse;
//
// @Component
// @Slf4j
// public class LoggingInterceptor implements HandlerInterceptor {
//     @Override
//     public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
//         // 打印请求信息
//         log.info("==============LoggingInterceptor开始==============");
//         log.info("请求地址: {}", request.getRequestURL().toString());
//         log.info("请求方法: {}", request.getMethod());
//         log.info("远程地址: {}", request.getRemoteAddr());
//         request.setAttribute("requestStartTime", System.currentTimeMillis());
//         return true;
//     }
//
//     @Override
//     public void postHandle(HttpServletRequest request, HttpServletResponse response, Object handler, ModelAndView modelAndView) throws Exception {
//         long startTime = (long) request.getAttribute("requestStartTime");
//         long endTime = System.currentTimeMillis();
//         log.info("===============LogInterceptor 结束，耗时: {} ms", endTime - startTime);
//     }
// }
